<?php
$c2_2 = '程序设计';
?>
<html>
    <head>
        <title>循环输出表格</title>
        <style>
            table tr td {
                padding: 15px 0;
            }
            .bg {
                background-color: bisque;
            }
        </style>
    </head>
    <body>
        <table width="100%" border="1" cellpadding="0" cellspacing="0">
            <thead>
                <tr>
                    <th>1</th>
                    <th>2</th>
                    <th>3</th>
                    <th>4</th>
                    <th>5</th>
                    <th>6</th>
                    <th>7</th>
                </tr>
            </thead>
            <tbody>
                <?php for($i = 1; $i <= 5; $i++):?>
                <tr>
                    <?php for($j = 1; $j <= 7; $j++) :?>
                        <td <?php if($i % 2 == 1):?> class="bg" <?php endif;?>>
                            <?php
                                $t = 'c' . $j . '_' . $i;
                                if(isset($$t)) {
                                    echo $$t;
                                }
                            ?>
                        </td>
                    <?php endfor;?>
                </tr>
                <?php endfor;?>
            </tbody>
        </table>
    </body>
</html>